<?php 

class Login_model{

	private $db;

	function __construct(){
		require_once('cruds.php');
		
		$this->db = new CRUDS();
	}
	
	function check_username($user, $pass){
		$this->db->select('*');
		$this->db->from('user');
		$this->db->inner_join('privilege', 'privilege.IDPRIVILEGE = user.IDPRIVILEGE');
		$this->db->where("USERNAME = '".$user."' AND PASSWORD = '".md5($pass)."'");
		
		$query = $this->db->get();//echo $query;
		return $query;
	}

}

?>